#pragma once
#include "mod.h"
#include <string>
#include <iostream>
#include <boost/thread.hpp>
#include <boost/function/function0.hpp>
#include "singal.h"

class audio_com :
        public mod_common
{
public:
    bool open();
    bool close();

    bool play();
    bool play(int times);
    bool pause();
    int stop();

    bool read(char *fp, int len, int val);
    bool write(char *fp, int len, int val);
    bool contrl(int com);

};

class audio_input:public mod_input{
public:
    char *get_data(){
        return nullptr;
    }
    char *get_command(){
        return nullptr;
    }
    char get_value_c(){
        return ' ';
    }
    int get_value(){
        return 0;
    }
    float get_value_f(){
        return 0.0;
    }
    double get_value_d(){
        return 0.0;
    }
};

class audio_output:public mod_output{
public:
    bool *set_data(){
        return false;
    }
    bool *set_command(){
        return false;
    }
    bool set_value_c(){
        return false;
    }
    bool set_value(){
        return false;
    }
    bool set_value_f(){
        return false;
    }
    bool set_value_d(){
        return false;
    }
};

class audio{
    long id;
    string name;
    singal_list singals;
protected:
    singal sig;
public:
    audio(string name);

    void set_contrl(singal::source sour=singal::source::dev,string path="/dev/audio");
    void set_play(singal::source sour=singal::source::file,string path="/bin/madplay");
};

